/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package kjemprosj;


/**
 *
 * @author Stine
 */

import java.lang.Math.*;
import static javax.swing.JOptionPane.*;

public class Metoder {
    private double mL_TilsattBase = 10;
            //Double.parseDouble(showInputDialog("Skriv inn antall mL tilsatt NaOH (base)"));
    private static double ML_HCL = 50;
    private static double KONS_BASE = 0.0001;
    private static double KONS_SYRE = 0.0001;
    private static double START_MOL_SYRE = (5.0 * Math.pow(10, -3));

    public double antMolBase() {
        double antMol = (KONS_BASE * mL_TilsattBase);
        return antMol;
    }

    public double antMolSyre() {
        double antMol = 0;
        if(START_MOL_SYRE > antMolBase()){
            antMol = (START_MOL_SYRE - antMolBase());
        } else {
            antMol = (antMolBase() - START_MOL_SYRE);
        }
        return antMol;
    }

    public double totalVolumLiter() {
        return (mL_TilsattBase + ML_HCL)/1000;
    }

    public double konsAvHIoner() {
        return antMolSyre()/totalVolumLiter();
    }

    public double pH() {
        double pH = -Math.log10(konsAvHIoner());
        return pH;
    }

    public double antVolumBase(double nyML) {
        mL_TilsattBase += nyML;
        return mL_TilsattBase;
    }
}
